package cn.b.sky.mes.hr.model.condition;

import java.util.List;

import cn.b.sky.mes.hr.model.ShiftingPermission;
import cn.b.sky.common.model.Page;

/**
 * 
 * <strong>Title : HrCondition.java<br></strong>
 * <strong>Package : cn.b.sky.mes.hr.model.condition<br></strong>
 * <strong>Description : </strong>hr模块的权限<br> 
 * <strong>Create on : 2016-4-1 下午5:01:38<br></strong>
 * <p>
 * @author lidapeng<br>
 * @version <strong>v1.0.0</strong><br>
 * <br>
 * <strong>修改历史:</strong><br>
 * 修改人 | 修改日期 | 修改描述<br>
 * -------------------------------------------<br>
 * <br>
 * <br> 
 */
public class HrCondition extends Page {
  /**
   * 当前用户的工作中心权限
   */
  List<ShiftingPermission> permission;

  /**
   * 工作中心字符串
   */
  private String workCenters;

  /**
   * 是否启用排班0--启用，1--不启用
   */
  private Integer isShifting;

  public List<ShiftingPermission> getPermission() {
    return permission;
  }

  public void setPermission(List<ShiftingPermission> permission) {
    this.permission = permission;
    if (!permission.isEmpty()) {
      String str = "";
      int i = 0;
      int count = permission.size();
      for (ShiftingPermission sp : permission) {
        str += "'" + sp.getWorkcenterCode() + "'";
        if (i < count - 1) {
          str += ",";
        }
        i++;
      }
      this.workCenters = str;
    } else {
      this.workCenters = "'-1'";
    }
  }

  /**
   * 获取工作中心权限字符，用于拼接sql
   */
  public String getWorkCenters() {
    return workCenters;
  }

  public void setWorkCenters(String workCenters) {
    this.workCenters = workCenters;
  }

  public Integer getIsShifting() {
    return isShifting;
  }

  public void setIsShifting(Integer isShifting) {
    this.isShifting = isShifting;
  }

}
